﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Create.aspx.cs" Inherits="H2.NET.Web.Management.Permission.Create" %>

<script type="text/javascript">
    function AddDetails() {
        var num = parseInt($("[name='dwz_rowNum']").val());
        var rows = $("#DetailTbody").find("tr").size();
        for (var i = parseInt(rows); i < num + parseInt(rows); i++) {
            $("#DetailTbody").append(
            "<tr>"
            + "<td><input type='text' name='Name' style='width:90%' class='textInput required'/></td>"
            + "<td><input type='text' name='Title' style='width:90%' class='textInput'/></td>"
            + "<td><input type='text' name='Url' style='width:90%' class='textInput required'/></td>"
            + "<td><input type='text' name='RelCode' style='width:90%' class='textInput'/></td>"
            + "<td><input type='text' name='Module' value='" + $("#Module").val() + "' style='width:90%' class='textInput'/></td>"
            + "<td><input type='text' name='Layer' style='width:90%' class='textInput' value='3' /></td>"
            + "<td><input type='text' name='Class' style='width:90%' class='textInput'/></td>"
            + "<td><input type='text' name='Order' value='" + (i + 1) + "' style='width:90%' class='textInput number'/></td>"
            + "<td><input type='text' name='FDataName'  style='width:90%' class='textInput'/></td>"
            + "<td><select name='FISLC'><option value=''>请选择</option><option value='否'>否</option><option value='是'>是</option></select></td>"
            + "<td><a href='javascript:void(0)' class='btnDel' onclick='$(this).parent().parent().remove();'>删除</a></td>"
            + "</tr>"
            );
        }
    }
    //更新下标
    function ReSetBoxOrder() {
        var i = 0;
        $("#DetailTbody").find("tr").each(function () {
            $(this).find("td").each(function () {
                var isDetail = false;
                $(this).find("input").each(function () {
                    var name = $(this).attr("name");
                    var newName = name.substring(0, name.indexOf("[") + 1) + i + name.substring(name.indexOf("]"));
                    $(this).attr("name", newName);
                    if (name.indexOf("DetailValue") >= 0 || name.indexOf("Order") >= 0) {
                        $(this).val(i + 1);
                    }
                });
            });
            i++;
        });
    }
</script>
<div class="pageContent">
    <form method="post" action="Management/Permission/Create.aspx?action=create" class="pageForm required-validate"
    onsubmit="return validateCallback(this, dialogAjaxDone);">
    <div class="pageFormContent" layouth="63">
        <input type="hidden" name="ParentID" value="<%= ParentID %>" />
        <input type="hidden" name="Module" value="<%= Module %>" id="Module" />
        <table class="formTable">
            <tr>
                <th width="30%">
                    父级菜单：
                </th>
                <td width="70%">
                    <asp:literal runat="server" id="ParentName" text="顶级菜单"></asp:literal>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <table class="list" width="100%">
                        <thead>
                            <tr>
                                <td colspan="11" style="background-color: #EEF2F6">
                                    <span style="float: left; padding-top: 5px; color: #183152">相关项：</span>
                                    <input class="textInput number" type="text" size="5" value="1" style="margin: 2px;
                                        display: none;" name="dwz_rowNum" />
                                    <div class="button">
                                        <div class="buttonContent">
                                            <button type="button" onclick="AddDetails()">
                                                添加</button>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <th style="text-align: center; width: 15%">
                                    权限名称
                                </th>
                                <th style="text-align: center; width: 15%">
                                    权限标题
                                </th>
                                <th style="text-align: center; width: 10%">
                                    URL地址
                                </th>
                                <th style="text-align: center; width: 10%">
                                    权限编码
                                </th>
                                <th style="text-align: center; width: 10%">
                                    模块
                                </th>
                                <th style="text-align: center; width: 10%">
                                    级别
                                </th>
                                <th style="text-align: center; width: 10%">
                                    Css样式
                                </th>
                                <th style="text-align: center; width: 5%">
                                    排序
                                </th>
                                <th style="text-align: center; width: 5%">
                                    数据库表名
                                </th>
                                <th style="text-align: center; width: 5%">
                                    是否流程
                                </th>
                                <th style="text-align: center; width: 5%">
                                    操作
                                </th>
                            </tr>
                        </thead>
                        <tbody id="DetailTbody">
                        </tbody>
                    </table>
                </td>
            </tr>
        </table>
    </div>
    <div class="formBar">
        <ul>
            <li>
                <div class="buttonActive">
                    <div class="buttonContent">
                        <button type="submit">
                            保存数据</button></div>
                </div>
            </li>
            <li>
                <div class="button">
                    <div class="buttonContent">
                        <button type="button" class="close">
                            关闭窗口</button></div>
                </div>
            </li>
        </ul>
    </div>
    </form>
</div>